package cn.huihuo.weibo.controller;

import cn.huihuo.weibo.bean.boutique.BoutiqueResultBean;
import cn.huihuo.weibo.service.BoutiqueService;
import cn.huihuo.weibo.service.MessageService;
import cn.huihuo.weibo.service.ParticipationService;
import cn.jfinalbbs.common.BaseController;
import cn.jfinalbbs.common.Constants;
import cn.jfinalbbs.user.User;

/**
 * Created by zhengjunbo on 2015/10/30.
 */
public class BoutiqueController extends BaseController {
    public void index(){
        User user = getSessionAttr(Constants.USER_SESSION);

        setAttr("messageSize", user==null?"": MessageService.service.total(user.getStr("id")));
        setAttr("participationSize", user==null?"": ParticipationService.service.findTotalParticipation(user.getStr("id")));
        render("huihuo/boutique.html");
    }

    public void findBoutique(){
        Integer pageStep = getParaToInt("pageStep");
        Integer count = getParaToInt("count");
        BoutiqueResultBean boutique = BoutiqueService.service.findBoutique(pageStep, count);
        success(boutique);
    }
}
